package com.ruoyi.common.core.page;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.util.List;

/**
 * @author tianl
 * @date 2023/4/27
 * @description:
 */
@Data
public class PageResp<T> {
    private Long pageNo;
    private Long pageSize;
    private Long totalPage;
    private Long total;
    private List<T> list;
    public PageResp(IPage<T> page, List<T> data) {
        this.pageNo = page.getCurrent();
        this.pageSize = page.getSize();
        this.total = page.getTotal();
        this.totalPage = page.getPages();
        this.list = data;
    }
    public PageResp(IPage<T> page) {
        this.pageNo = page.getCurrent();
        this.pageSize = page.getSize();
        this.total = page.getTotal();
        this.totalPage = page.getPages();
        this.list = page.getRecords();
    }

    public PageResp(long pageNo, long pageSize, long total, long totalPage, List<T> data) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.total = total;
        this.totalPage = totalPage;
        this.list = data;
    }
}
